import { request } from "@umijs/max";

/** 企业用户注册*/
export async function register(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/enterprise-users/register`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业用户登录*/
export async function login(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/auth/login`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业用户修改密码*/
export async function password(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/enterprise-users/update/pass`, {
    method: 'PUT',
    data:(options || {}),
  });
}


/** 企业用户更新信息*/
export async function updateCompany1(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/enterprise-users/update`, {
    method: 'PUT',
    data:(options || {}),
  });
}

/** 企业用户数字化改造需求保存*/
export async function step1(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/company-demand-situations/step1`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 上传文件并获取文件URL */
export async function uploadFile(file: any) {
  const formData = new FormData();
  formData.append('file', file); // 'file' 需与后端接收文件的参数名一致

  return request<any>('/api/upload/single', { // 替换为你的文件上传接口地址
    method: 'POST',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/** 根据事件ID获取数字化改造需求 */
export async function demand(
    params: {
        companyId:string
    },
    options?: { [key: string]: any },
) {
    return request<any>(`${API_EXP}/api/company-demand-situations/project/demand`, {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}

/** 企业用户数字化改造情况保存*/
export async function step2(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/company-demand-situations/step2`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业用户数字化提交*/
export async function confirmDigital(options?: { [key: string]: any }) {
  return request<any>(`${API_EXP}/api/company-demand-situations/confirm`, {
    method: 'POST',
    data:(options || {}),
  });
}



/** 根据事件ID获取数字化改造情况 */
export async function situation(
    params: {
        companyId:string
    },
    options?: { [key: string]: any },
) {
    return request<any>(`${API_EXP}/api/company-demand-situations/project/situation`, {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}

/** 查询企业账号 */
export async function pageUsers(
  params: {
    // query
    current: string;
    size:string;
    productName?:string;
    fwslx?:string;
    status?:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-register-audit/page`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查询企业账号 */
export async function pageUsersDemand(
  params: {
    // query
    current: string;
    size:string;
    userType:string;
    region:string;
    auditStatus:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/enterprise-user-audits/demand/page `, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新企业用户*/
export async function update(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/enterprise-users/update`, {
    method: 'PUT',
    data:(options || {}),
  });
}

/** 删除企业用户号 */
export async function removeUsers(
  params: {
    // query
    id: string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-register-audit/remove`, {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查询企业项目备案记录 */
export async function pageRecord(
  params: {
    // query
    current: string;
    size:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-demand-audit/page`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 删除企业项目备案 */
export async function removeRecord(
  params: {
    // query
    id: string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/company-demand-situations/remove`, {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新企业用户*/
export async function updateCompany(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-register-audit/update`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 审核企业*/
export async function auditCompany(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-register-audit/audit`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 更新企业项目*/
export async function updateProgram(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-demand-audit/update`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 更新企业项目验收*/
export async function updateProgramCheck(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-accept-audit/update`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 政府审核企业备案*/
export async function govermentAuditProgram(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-demand-audit/audit`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 查看项目审核进度*/
 export async function programProgress(
  params: {
    // query
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-demand-audit/progress`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查看项目验收进度*/
 export async function programCheckProgress(
  params: {
    // query
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-accept-audit/progress`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查看用户审核进度*/
 export async function userProgress(
  params: {
    // query
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-register-audit/progress`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 企业项目实施*/
export async function programSave(options?: { [key: string]: any }) {
  return request<any>(`${API_EXP}/api/company-implementation/save`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 获取企业项目实施*/
 export async function getProgram(
  params: {
    // query
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/company-implementation/enterprise`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 企业项目验收填写*/
export async function acceptance(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/company-acceptance/save`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业查看办理进度*/
 export async function companyCheckProgress(
  params: {
    // query
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/enterprise-users/progress`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 评测机构查询数据 */
export async function pageRate(
  params: {
    // query
    current: string;
    size:string;
    companyName?:string;
    auditStatus?:string;
    departmentName?:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/third-audit/page`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 评测机构上传文件 */
export async function confirmRate(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/third-audit/rate/confirm`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业反显评测报告和审计报告 */
export async function companyReports(
  params: {
    // query
    companyId: string;
    projectId:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/company-acceptance/company-project`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 企业项目实施点击下一步 */
export async function companyFourNext(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/third-audit/rate/add`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业 提交项目验收 */
export async function companySubmit(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/company-acceptance/confirm`, {
    method: 'POST',
    data:(options || {}),
  });
}

/** 企业需求提交，二次审核 */
export async function twoChangeToConfirm(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/company-demand-situations/change`, {
    method: 'POST',
    data:(options || {}),
  });
}


/** 第三方机构查询提交报告 */
export async function getThirdReport(
  params: {
    // query
    current: string;
    size:string;
    userType:string;
    companyName?:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/third-audit/page`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取项目验收管理记录 */
export async function getProgramRecord(
  params: {
    // query
    current: string;
    size:string;
    userType:string;
    companyName?:string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/v-accept-audit/page`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 政府项目验收审核 */
export async function programCheck(options?: { [key: string]: any }) {
  return request<Record<string, any>>(`${API_EXP}/api/v-accept-audit/audit`, {
    method: 'POST',
    data:(options || {}),
  });
}


/** 预览文件 */
export async function filePreview(
  params: {
    // query
    path: string;
  },
  options?: { [key: string]: any },
) {
  return request<any>(`${API_EXP}/api/file/preview`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}